/*This do file takes a Master dataset and creates bydep and byvote files, which are necessary to generate Loser (RLoser, RRoll, RStuff, ULoser, URoll, UStuff) scores and indices.*/clearset memory 110m set matsize 800set maxvar 32766 /*maximum variable size for Stata 7.0 is 2047. if you are running stata 7.0, change "set maxvar" to 2047*/set more offlocal country "Peru"	/* "country" is the name of the country in the data set */local congress "19992000"			local master "C:\WINDOWS\Desktop\Carey\masterdata/`country'Master`congress'.dta"				/* "master" is the file name of the master file regarding that country.  It contains a 				DEPUTY x VOTE matrix, with an observation named THRESH and a variable named PARTY (or whatever 				unit of analysis there will be) as well.  				In other words, down the left side of the matrix it should read "THRESH, D001, D002," etc.       				Across the top of the matrix should read "party, v1, v2, v3," etc.				There is NO OTHER information in this master data set.  				Observations regarding date, issue coding, or any other information must be deleted 				before this file is named the master file */local output "c:\windows\desktop\carey\loserdata\" 						/* "output" is the basic path name for the output file that this code generates.  */use "`master'"keep in 1drop deputy coalitionxpose, clear varnamerename v1 threshrename _varname votenumorder votenum threshsave "`output'\`country'`congress'byvote.dta", replaceuse "`master'"drop in 1rename coalition partysave "`output'\`country'`congress'bydep.dta", replace